<!DOCTYPE html>
<html>
	<head>
		<title>百度网盘资源分享</title>
		<meta charset="utf-8">
		<script src="js/axios.js"></script>
		<script>
			function format(str, args) {
				return str.replace(/{(\d+)}/g, (match, index) => args[index]);
			}

			function sendRequest() {
				let inputStr = document.getElementById("inputText").value;
				let mode = document.getElementById("mode").value;
				let cookie = document.getElementById("cookie").value;
				const lines = inputStr.split('\n'); // 按行分割文本
				let index = 0
				let headers = {
					'Cookie': cookie,
					'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
				}

				console.log('inputStr', inputStr, cookie, lines.length)

				function requestRoll() {
					console.log('requestRoll', index)
					if (index < lines.length) {
						const arr = lines[index].split(',')
						// const data = JSON.parse(format(mode, arr))
						// axios.post('https://fc-mp-45004f13-e190-4608-8f1f-968551d365c9.next.bspapp.com/auto', {
						// 	data: data,
						// 	url: 'https://wpzy.cc/api/discussions',
						// 	headers: headers
						// }).then(res => {
						// 	console.log(res)
						// }).catch(err => {
						// 	console.error(lines[index])
						// 	console.log(err)
						// }).finally(() => {
						// 	setTimeout(() => {
						// 		index++
						// 		requestRoll()
						// 	}, 30000)
						// })
						const form = new FormData();
						form.append('doctype', '0');
						form.append('quotepid', '0');
						form.append('fid', '1');
						form.append('subject', format('【每日短剧】【夸克】{0} 附短剧热力排行榜',arr));
						form.append('tagid[]', '1');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '');
						form.append('tagid[]', '86');
						form.append('tagid[]', '17');
						form.append('message',format("<p>{0}</p><p>{1}</p><p><p>【短剧热力排行榜】<br/></p><p>[ttreply] 1、遥不可及的爱 https://pan.quark.cn/s/d7fde8de7641&nbsp;</p><p>2、开局离婚天后演唱会现场请我出道 https://pan.quark.cn/s/0af8de8692f7 3、热辣滚烫的婚姻 https://pan.quark.cn/s/8d115020dcdf&nbsp;</p><p>4、景少帅你搞错心上人了 https://pan.quark.cn/s/79ae49514686&nbsp;</p><p>5、隐世龙凤 https://pan.quark.cn/s/9d7beeb6686d&nbsp;</p><p>6、非爱勿扰 https://pan.quark.cn/s/0f75b16256c1&nbsp;</p><p>7、卧虎藏龙 https://pan.quark.cn/s/00245bd13621&nbsp;</p><p>8、将军令 https://pan.quark.cn/s/1efc4f4dee6c&nbsp;</p><p>9、飞驰人生之1988 https://pan.quark.cn/s/8503962805fa&nbsp;</p><p>10、天王巨星 https://pan.quark.cn/s/55b3035eed88 [/ttreply]</p><p><br/></p>",arr));
						form.append('auto_hiddenlinks', 'on');
						form.append('content_num_status', '0');
						form.append('must_pay_content', '');
						form.append('content_num', '1');
						form.append('content_type', '金币');
						form.append('insert_hide', '');
						form.append('hide_type', '1');
						axios.post('https://www.yunpanziyuan.xyz/thread-create.htm', form, {
							headers
						}).then(res => {
							console.log(res)
						}).catch(err => {
							console.error(lines[index])
							console.log(err)
						}).finally(() => {
							setTimeout(() => {
								index++
								requestRoll()
							}, 30000 + Math.floor(Math.random() * 10000))
						})
					}
				}
				requestRoll()
			}
			const modeData = {
				doctype: '0',
				quotepid: '0',
				fid: '1',
				subject: '【每日短剧】【夸克】{0} 附短剧热力排行榜',
				tagid: ['1', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '86', '17'],
				message: "<p>{0}</p><p>{1}</p><p><p>【短剧热力排行榜】<br/></p><p>[ttreply] 1、遥不可及的爱 https://pan.quark.cn/s/d7fde8de7641&nbsp;</p><p>2、开局离婚天后演唱会现场请我出道 https://pan.quark.cn/s/0af8de8692f7 3、热辣滚烫的婚姻 https://pan.quark.cn/s/8d115020dcdf&nbsp;</p><p>4、景少帅你搞错心上人了 https://pan.quark.cn/s/79ae49514686&nbsp;</p><p>5、隐世龙凤 https://pan.quark.cn/s/9d7beeb6686d&nbsp;</p><p>6、非爱勿扰 https://pan.quark.cn/s/0f75b16256c1&nbsp;</p><p>7、卧虎藏龙 https://pan.quark.cn/s/00245bd13621&nbsp;</p><p>8、将军令 https://pan.quark.cn/s/1efc4f4dee6c&nbsp;</p><p>9、飞驰人生之1988 https://pan.quark.cn/s/8503962805fa&nbsp;</p><p>10、天王巨星 https://pan.quark.cn/s/55b3035eed88 [/ttreply]</p><p><br/></p>",
				auto_hiddenlinks: 'on',
				content_num_status: '0',
				must_pay_content: '',
				content_num: '1',
				content_type: '金币',
				insert_hide: '',
				hide_type: '1'
			}
			setTimeout(() => {
				document.getElementById("mode").value = JSON.stringify(modeData)
			}, 500)
		</script>
	</head>
	<body>
		<textarea id="cookie" cols="50" style="min-height: 50px;" placeholder="cookie"></textarea>
		<br>
		<textarea id="inputText" cols="100" style="min-height: 150px;"></textarea>
		<br>
		<button onclick="sendRequest()">发送</button>
		<br>
		<textarea id="mode" cols="100" style="min-height: 150px;"></textarea>
	</body>
</html>